﻿<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="AddNewEbook.ascx.cs"
    Inherits="NLLSite.Administrator.UserControl.AddNewEbook" %>
<%@ Register Assembly="CKEditor.NET" Namespace="CKEditor.NET" TagPrefix="CKEditor" %>
<script type="text/javascript" src="../../ckfinder/ckfinder.js"></script>
<script type="text/javascript">
    function BrowseServer() {
        // You can use the "CKFinder" class to render CKFinder in a page:
        var finder = new CKFinder();
        finder.basePath = '../../ckfinder/'; // The path for the installation of CKFinder (default = "/ckfinder/").
        finder.selectActionFunction = SetFileField;
        finder.popup();

        // It can also be done in a single line, calling the "static"
        // popup( basePath, width, height, selectFunction ) function:
        // CKFinder.popup( '../', null, null, SetFileField ) ;
        //
        // The "popup" function can also accept an object as the only argument.
        // CKFinder.popup( { basePath : '../', selectActionFunction : SetFileField } ) ;
    }

    // This is a sample function which is called when a file is selected in CKFinder.
    function SetFileField(fileUrl) {
        document.getElementById('ctl00_ContentPlaceHolderCenter_AddNewEbook1_txtImage').value = fileUrl;
        //Element ID = Ten class usercontrol + 1 + ID cua text box.
    }

    function BrowseServerFile() {
        // You can use the "CKFinder" class to render CKFinder in a page:
        var finder = new CKFinder();
        finder.basePath = '../../ckfinder/'; // The path for the installation of CKFinder (default = "/ckfinder/").
        finder.selectActionFunction = SetFileFieldFile;
        finder.popup();

        // It can also be done in a single line, calling the "static"
        // popup( basePath, width, height, selectFunction ) function:
        // CKFinder.popup( '../', null, null, SetFileField ) ;
        //
        // The "popup" function can also accept an object as the only argument.
        // CKFinder.popup( { basePath : '../', selectActionFunction : SetFileField } ) ;
    }

    // This is a sample function which is called when a file is selected in CKFinder.
    function SetFileFieldFile(fileUrl) {
        document.getElementById('ctl00_ContentPlaceHolderCenter_AddNewEbook1_txtFile').value = fileUrl;
        //Element ID = Ten class usercontrol + 1 + ID cua text box.
    }
</script>
<div class="box box-100">
    <div class="boxin">
        <div class="header">
            <h3>
                Thêm mới Slide</h3>
        </div>
        <div style="padding: 18px;">
            <!--<form class="basic" action="" method="post" enctype="multipart/form-data"><!-- Default basic forms -->
            <div class="inner-form">
                <asp:Panel ID="Panel1" runat="server">
                    <table>
                        <tr>
                            <td width="130">
                                Tên Ebook:
                            </td>
                            <td>
                                <asp:TextBox ID="txtName" runat="server" Width="250px"></asp:TextBox>
                            </td>
                            <td>
                                &nbsp;
                            </td>
                        </tr>
                        <tr>
                            <td width="130">
                                Đường dẫn ảnh:
                            </td>
                            <td>
                                <asp:TextBox ID="txtImage" runat="server" AutoPostBack="True" Width="250px"></asp:TextBox>
                                <input type="button" value="Browse Server" onclick="BrowseServer();" class="altbutton" />
                            </td>
                            <td>
                                &nbsp;
                            </td>
                        </tr>
                        <tr>
                            <td valign="top" width="130">
                                Miêu tả:
                            </td>
                            <td>
                                <CKEditor:CKEditorControl ID="CKEditor1" runat="server" Width="600px"></CKEditor:CKEditorControl>
                            </td>
                            <td>
                                &nbsp;
                            </td>
                        </tr>
                        <tr>
                            <td width="130">
                                Đường dẫn file:
                            </td>
                            <td>
                                <asp:TextBox ID="txtFile" runat="server" AutoPostBack="True" Width="250px"></asp:TextBox>
                                <input type="button" value="Browse Server" onclick="BrowseServerFile();" class="altbutton" />
                            </td>
                            <td>
                                &nbsp;
                            </td>
                        </tr>
                        <tr>
                            <td width="130">
                                &nbsp;
                            </td>
                            <td>
                                &nbsp;
                                <asp:Label ID="Label1" runat="server" ForeColor="Red"></asp:Label>
                            </td>
                            <td>
                                &nbsp;
                            </td>
                        </tr>
                        <tr>
                            <td width="130">
                                &nbsp;
                            </td>
                            <td>
                                &nbsp;
                                <asp:Button ID="btnAdd" runat="server" OnClick="btnAdd_Click" Text="Thêm mới" 
                                    CssClass="altbutton" />
                                <a href="QuanlyEbook.aspx"><input type="button" value="Quay về trang quản lý" class="altbutton" /></a> 
                            </td>
                            <td>
                                &nbsp;
                            </td>
                        </tr>
                        <tr>
                            <td width="130">
                                &nbsp;
                            </td>
                            <td>
                                &nbsp;
                            </td>
                            <td>
                                &nbsp;
                            </td>
                        </tr>
                    </table>
                </asp:Panel>
            </div>
        </div>
    </div>
</div>
